package com.yhb.channel.utils;

import com.yhb.channel.model.IBankCard;
import lombok.var;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
import java.util.List;

/**
 * 检查卡的银行卡在不在白名单里
 */
public class WhiteListVerifier implements CardSupportiveVerifier {
    private List<String> list;
    @NotNull
    public static WhiteListVerifier of(String ...bankNames) {
        var instance = new WhiteListVerifier();
        instance.list = Arrays.asList(bankNames);
        return instance;
    }

    @Override
    public boolean support(IBankCard card) {
        return list.contains(card.getBankName());
    }
}
